import Mock from 'mockjs'
// 登录
Mock.mock(import.meta.env.VITE_BASE_URL + '/auth/login', 'post', () => {
  return {
    code: 200,
    msg: "登录成功",
    data: {
      tokenType: "Bearer",
      access_token: "57774f0c-4f06-4197-b8ac-72a38b4c4281",
    },
    ok: true,
  };
  // return {
  //   code: 501,
  //   msg: '登录失败',
  //   data: null,
  //   ok: true,
  // }
})
// 获取用户信息
Mock.mock(import.meta.env.VITE_BASE_URL + '/auth/info', 'get', () => {
  return {
    code: 200,
    msg: '查询成功',
    data: {
      user: {
        createBy: 'admin',
        createTime: '2021-03-30 19:40:20',
        updateBy: null,
        updateTime: null,
        remark: '超级管理员',
        params: {},
        userId: 1,
        deptId: '100',
        userName: 'admin',
        nickName: '超级管理员',
        email: '',
        phonenumber: '15010218580',
        linephone: '',
        sex: '1',
        avatar: 'http://10.68.10.154:10240/chn-energy/2021/08/24/9a7ad15c-3cfc-4bb0-89ca-3086eb3bf353.jpeg',
        password: '',
        status: '0',
        delFlag: '0',
        loginIp: '127.0.0.1',
        loginDate: '2021-03-30T19:40:20.000+08:00',
        dept: {
          searchValue: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          remark: null,
          params: {},
          deptId: '100',
          parentId: '0',
          ancestors: null,
          deptName: '国能铁路装备有限责任公司',
          orderNum: '0',
          deptType: null,
          leader: '',
          phone: null,
          email: null,
          status: '0',
          delFlag: null,
          parentName: null,
          deptCode: null,
          fullName: null,
          parentCode: null,
          codePath: null,
          instid: null,
          children: [],
        },
        roleIds: null,
        postIds: null,
        firstName: null,
        lastName: null,
        admin: true,
      },
      roles: ['admin'],
      permissions: ['*:*:*'],
    },
    ok: true,
  }
})
// 获取权限路由
Mock.mock(import.meta.env.VITE_BASE_URL + '/auth/getRoutes', 'get', () => {
  return {
    code: 200,
    msg: '查询成功',
    data: [
      {
        name: 'System',
        path: '/system',
        redirect: 'noRedirect',
        component: 'Layout',
        alwaysShow: true,
        meta: {
          title: '系统管理',
          icon: 'icon-xitongguanli',
          noCache: false,
          hidden: false,
        },
        children: [
          {
            name: 'User',
            path: 'user',
            // hidden: false,
            component: 'system/user/index',
            meta: {
              title: '用户管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'AddUser',
            path: 'addUser',
            component: 'system/user/addUser',
            meta: {
              title: '新增用户',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: true,
            },
          },
          {
            name: 'EditUser',
            path: 'editUser',
            component: 'system/user/editUser',
            meta: {
              title: '修改用户',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: true,
            },
          },
          {
            name: 'Role',
            path: 'role',
            component: 'system/role/index',
            meta: {
              title: '角色管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Menu',
            path: 'menu',
            // hidden: false,
            component: 'system/menu/index',
            meta: {
              title: '菜单管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Dept',
            path: 'dept',
            // hidden: false,
            component: 'system/dept/index',
            meta: {
              title: '部门管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Post',
            path: 'post',
            // hidden: false,
            component: 'system/post/index',
            meta: {
              title: '岗位管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Dict',
            path: 'dict',
            // hidden: false,
            component: 'system/dict/index',
            meta: {
              title: '字典管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Config',
            path: 'config',
            // hidden: false,
            component: 'system/config/index',
            meta: {
              title: '参数设置',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Jobcontactsheet',
            path: 'jobcontactsheet',
            // hidden: false,
            component: 'system/Jobcontactsheet/index',
            meta: {
              title: '工作联络单',
              icon: '',
              noCache: false,
              hidden: false,
            },
          },
          {
            name: 'Log',
            path: 'log',
            redirect: 'noRedirect',
            component: 'ParentView',
            alwaysShow: true,
            meta: {
              title: '日志管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
            children: [
              {
                name: 'Operlog',
                path: 'operlog',
                component: 'system/log/operlog',
                meta: {
                  title: '操作日志',
                  icon: 'icon-antdfrown',
                  noCache: false,
                  hidden: false,
                },
              },
              {
                name: 'Logininfor',
                path: 'logininfor',
                component: 'system/log/logininfor',
                meta: {
                  title: '登录日志',
                  icon: 'icon-antdfrown',
                  noCache: false,
                  hidden: false,
                },
              },
            ],
          },
        ],
      },
      {
        name: 'Business',
        path: '/business',
        redirect: '/business/busi',
        component: 'Layout',
        alwaysShow: true,
        meta: {
          title: '业务管理',
          icon: 'icon-antdfrown',
          noCache: false,
          hidden: false,
        },
        children: [
          {
            name: 'Busi',
            path: 'busi',
            component: 'system/user/index',
            meta: {
              title: '业务管理',
              icon: 'icon-antdfrown',
              noCache: false,
              hidden: false,
            },
          },
        ],
      },
    ],
    ok: true,
  }
})
